package com.lst.api.constant;

import java.util.HashMap;
import java.util.Map;

/**
 * @author: Frank
 * @date: 2019/12/30 14:33
 * @version: V1.0
 */
public enum StatusEnum {

    FORBIDDEN(0, "禁用"),
    NORMAL(1, "有效");

    StatusEnum(Integer key, String value){
        this.key = key;
        this.value = value;
    }

    private Integer key;
    private String value;

    private static final Map<Integer, StatusEnum> KEY_MAP = new HashMap<>();

    static{
        for (StatusEnum item : StatusEnum.values()) {
            KEY_MAP.put(item.getKey(), item);
        }
    }

    public Integer getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    public static StatusEnum getByKey(Integer key) {
        return KEY_MAP.get(key);
    }
}
